<?php $auth=0; ?>
<?php include 'lib/includes.php'; ?>
<?php include 'partials/header_menu.php'; ?>
<?php 
$select=$db->query('select societeId,societeNom,societeRef,societeDetails from societe');
$socs=$select->fetchAll();
/**
*suppression
**/
if(isset($_GET['delete']))
{
    
	$id=$db->quote($_GET['delete']);
	$db->query("delete from societe where societeId=$id");
	header('Location: /prescription/company.php');
		die();
}
?>

<br>
<br>
<h3>&nbsp;&nbsp;La liste des sociétés</h3>
<br>
<p>&nbsp;&nbsp;&nbsp;<a href="company_edit.php" class="btn btn-success">ajouter une nouvelle société&nbsp;<span  class="glyphicon glyphicon-plus"></span></a><p>
<br>
<center>
<table class="table table-hover">
	<thead>
		<tr>
			<th>Id</th>
			<th>société</th>
			<th>Siret</th>
			<th>autres détailles</th>
		</tr>
	</thead>
	<tbody>
	<?php foreach($socs as $soc){ ?>
	<tr>
			<th><h6><?php echo($soc['societeId']); ?></h6></th>
			<th><h6><?php echo($soc['societeNom']); ?></h6></th>
			<th><h6><?php echo($soc['societeRef']) ;?></h6></th>
			<th><h6><?php echo($soc['societeDetails']); ?></h6></th>
			<th><a href="company_edit.php?id=<?php echo($soc['societeId']); ?>" class="glyphicon glyphicon-edit"><h6>editer</h6></a>
			&nbsp;&nbsp;
			<a href="company.php?delete=<?php echo($soc['societeId']); ?>" class="glyphicon glyphicon-remove" onclick="return confirm('Voulez vous supprimer?');"><h6>supprimer</h6></a></th>
	</tr>
	</tbody>
	<?php }  ?>
</table>
</center>
<?php include 'partials/footer.php'; ?>
